/**
 * @file rank/elementary/luogu1085/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/7 13:36:43
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int most = 0, day = 0;
int main() {
  // High rating and good luck!
  for (int i = 1; i <= 7; ++i) {
    int a, b;
    cin >> a >> b;
    if (a + b > 8) {
      if (a + b > most) {
        most = a + b;
        day = i;
      }
    }
  }
  cout << day << endl;
  return 0;
}
